package com.chezhujie.www.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.chezhujie.www.domain.Czjdataresource;
import com.chezhujie.www.service.SortingService;

/**
 * Created by 汤伟杰 on 2017/5/18.
 */
@Controller
@RequestMapping("/sortApi")
public class SortingApiController extends BaseController {
	@Autowired
	private SortingService sortingService;

	/**
	 * 获取首页模板顺序
	 * 方法名：list
	 * 创建人：RUI
	 * 时间：2017年6月9日-上午9:25:18 
	 * @param req
	 * @param resp
	 * @param model void
	 * @exception 
	 * @since  1.0.0
	 */
	@RequestMapping("list")
	public void list(HttpServletRequest req, HttpServletResponse resp,
			ModelMap model) {

		try {
			List<Map<String, Object>> list = sortingService.listApi();
			jsonResult(1, "", "", list, resp);
		} catch (Exception e) {
			e.printStackTrace();
			jsonResult(0, "135", "首页查询模板顺序失败", "", resp);
		}

	}
	

    
    /***
     * 
     * 方法名：goUpdateHyjgApi 接口获取会员价格
     * 创建人：RUI
     * 时间：2017年6月8日-下午7:08:15 
     * @param req
     * @param resp
     * @param model
     * @return
     * @throws Exception String
     * @exception 
     * @since  1.0.0
     */
     @RequestMapping("/listHyjgApi")
     public void listHyjgApi(HttpServletRequest req, HttpServletResponse resp,
                        ModelMap model) throws Exception {
     	
     	try {
 			Czjdataresource czjdataresource=sortingService.getCzjdataresourceByCode();
 			jsonResult(1, "", "", czjdataresource, resp);
 		} catch (Exception e) {
 			e.printStackTrace();
 			jsonResult(0, "137", "获取会员价格错误", "", resp);
 		}
       
     }
	

}
